package com.example.demo.Controller;

import com.example.demo.Bean.AllSeckill;
import com.example.demo.Bean.IndexProduct;
import com.example.demo.Service.IndexProductService;
import com.example.demo.Service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class IndexProductController {
    @Autowired
    private IndexProductService indexProductService;

    @Autowired
    private UserService userService;

    @GetMapping("/index/products")
    public List<IndexProduct> indexProductList(){
        return indexProductService.QueryAllIndexProduct();
    }

    @GetMapping("/getAllSeckill")
    public List<AllSeckill> getALlSeckill(String nowtime){
        return indexProductService.getAllSeckill(nowtime);
    }

    @GetMapping("/getUserIntegralByUserName")
    public Integer getUserIntegral(String username){
        return userService.getIntegralByUserName(username);
    }

}
